<template>
  <div class="jpbox">
    <div
      class="dialogBody common"
      :style="{ height: '100%' }"
      style="overflow: hidden !important"
    >
      <div class="app-container-btn">
        <el-button
          type="primary"
          v-if="btnShow"
          @click="yj_saveForm('formData')"
        >
          保存
        </el-button>
        <el-button @click="goBack">返回</el-button>
      </div>
      <div style="height: 100%">
        <div class="tab">
          <div
            v-for="(data, index) in typeData"
            :key="data.value"
            @click="changeType($event, index)"
          >
            <div
              class="btn"
              :style="{
                color: data.show === true ? 'rgba(0, 117, 255, 1)' : '#343639',
                background: data.show === true ? '#E0EFFF' : '#fff',
              }"
            >
              {{ data.text }}
            </div>
          </div>
        </div>
        <div
          class="charts"
          v-if="typeData[1].show"
          style="display: flex; flex-direction: column"
        >
          <div class="app-container-area-title">
            <span class="app-container-area-title-divider"></span>
            <span>沥青混合料类型：{{ formData.fMixturetype }}</span>
          </div>
          <div style="margin-top: 8px">
            <multiLevelTableData
              :config="type_config"
              :dataList="lqtableData"
            />
          </div>
          <div class="jipeiBoxs" style="margin-top: 20px">
            <div class="left">
              <div class="app-container-area-title">
                <span class="app-container-area-title-divider"></span>
                <span>通过率分析</span>
              </div>
              <div class="errorMonitoring">
                <errorMonitoring :commonData="lineList"></errorMonitoring>
              </div>
            </div>
            <div class="right">
              <div class="baseTitle" style="margin-top: 8px">报警详情</div>
              <div class="errorMonitoring">
                <div class="tableWaring">
                  <div class="line">
                    <div class="tableName">标段名称</div>
                    <div class="tableData">{{ formData.fCompanyname }}</div>
                  </div>
                  <div class="line">
                    <div class="tableName">拌和机名称</div>
                    <div class="tableData">{{ formData.fMachineid }}</div>
                  </div>
                  <div class="line">
                    <div class="tableName">出料时间</div>
                    <div class="tableData">{{ formData.fDischargedates }}</div>
                  </div>
                  <div class="line">
                    <div class="tableName">施工层位</div>
                    <div class="tableData">
                      {{ formData.fConstructionhorizon }}
                    </div>
                  </div>
                  <div class="line">
                    <div class="tableName">混合料类型</div>
                    <div class="tableData">{{ formData.fMixturetype }}</div>
                  </div>
                  <div class="line">
                    <div class="tableName">配合比编号</div>
                    <div class="tableData">{{ formData.fMixnumber }}</div>
                  </div>
                  <div class="line">
                    <div class="tableName">报警级别</div>
                    <div class="tableData">{{ formData.fWarninglevel }}</div>
                  </div>
                  <div class="line">
                    <div class="tableName">报警内容</div>
                    <div class="tableData">{{ warningItems }}</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

        <div
          class="charts"
          v-if="typeData[0].show"
          style="overflow-y: auto; margin-bottom: 20px"
        >
          <div class="app-container-area-title">
            <span class="app-container-area-title-divider"></span>
            <span>基本信息</span>
          </div>
          <div class="table_detail">
            <publicForm
              ref="publicForm"
              lableWidth="95px"
              :formObj="ssformObj"
              :formData="formData"
            >
            </publicForm>
          </div>
          <div class="app-container-area-title">
            <span class="app-container-area-title-divider"></span>
            <span>材料用量</span>
          </div>
          <div
            style="margin-top: 8px; height: 180px; box-sizing: border-box"
            class="lqlevelClass"
          >
            <tableData
              :config="material_config"
              :dataList="materialData"
              statusType="2"
              :level="level"
              :currentRow="false"
              :stripe="false"
            />
          </div>
          <div class="app-container-area-title" v-if="handNum">
            <span class="app-container-area-title-divider"></span>
            <span>处理情况</span>
          </div>

          <el-collapse v-model="activeNames" @change="changeCollapse">
            <el-collapse-item name="0" v-if="handNum">
              <template slot="title">
                <div>
                  <img
                    style="vertical-align: middle"
                    src="@/assets/img/Supervision/com_flg.png"
                    alt=""
                  />
                  <span style="margin-left: 8px">闭合申请单</span>
                </div>
              </template>
              <div style="height: 160px; margin-top: 3px">
                <publicForm
                  ref="publicForm0"
                  lableWidth="95px"
                  :formObj="handleObj"
                  :formData="handleData"
                  :timestamp="handleData.fHandlefile"
                  :fileList="fSourcefileList"
                  @delteFile="delteFile"
                >
                </publicForm>
              </div>
            </el-collapse-item>
            <el-collapse-item name="1" v-if="firstNum">
              <template slot="title">
                <div>
                  <img
                    style="vertical-align: middle"
                    src="@/assets/img/Supervision/com_flg.png"
                    alt=""
                  />
                  <span style="margin-left: 8px">一级审核</span>
                </div>
              </template>
              <div style="height: 70px; margin-top: 3px">
                <publicForm
                  ref="publicForm1"
                  lableWidth="95px"
                  :formObj="processObj"
                  :formData="handleData"
                >
                </publicForm>
              </div>
            </el-collapse-item>
            <el-collapse-item name="2" v-if="secondNum">
              <template slot="title">
                <div>
                  <img
                    style="vertical-align: middle"
                    src="@/assets/img/Supervision/com_flg.png"
                    alt=""
                  />
                  <span style="margin-left: 8px">二级审核</span>
                </div>
              </template>
              <div style="height: 70px; margin-top: 3px">
                <publicForm
                  ref="publicForm2"
                  lableWidth="95px"
                  :formObj="examineObjs"
                  :formData="handleData"
                >
                </publicForm>
              </div>
            </el-collapse-item>
          </el-collapse>
          <div style="height: 50px"></div>
        </div>
      </div>
    </div>
    <!-- <div style="height:50px" v-if="btnShow"></div>
        <div class="newlyAdded_btn" v-if="btnShow">
            <el-button type="primary" @click="yj_saveForm('formData')">保存</el-button>
            <el-button type="warning" @click="close">关闭</el-button>
        </div> -->
  </div>
</template>

<script>
import errorMonitoring from "@/components/pitchManage/dyMonitorManage/errorMonitoring";
import publicForm from "@/components/public/el-form.vue"; //弹框form
import multiLevelTableData from "@/components/public/multiLevel-table"; //主页面列表
import formJs from "./regexDetail.js"; //新增弹框配置项
import TableData from "@/components/pitchManage/dyMonitorManage/el-tables"; //主页面列表
import actions from "@/actions";

import {
  addAsphaltClosedForm, //编辑保存
  getAsphaltClosedFormByParentId, //闭合-表单详情
} from "@/api/request.js";

export default {
  props: ["commonData"],
  data() {
    return {
      allData: null,
      ssformObj: formJs.ssformObj, //基本数据材料详情
      lqtableData: [],
      formObj: formJs.formObj, //新增编辑配置参数
      handleObj: formJs.handleObjs, //新增编辑配置参数
      handleObjs1: formJs.handleObjs1,
      processObj: formJs.processObjs, //一级审核
      processObj1: formJs.processObjs1, //一级审核
      examineObjs: formJs.examineObjs, //二级审核
      examineObjs1: formJs.examineObjs1, //二级审核
      formData: {}, //新增编辑向后台传递对象
      handleData: {
        fCompanyid: "", // 施工标段id
        fId: "", // 申请单fid //为空判断为新增
        fParentid: "", // 对应的超标记录fid
        fWarningcontent: "", // 预警内容
        fReason: "", // 问题原因
        fHandleway: "", // 处理方式
        fHandleresult: "", // 处理结果
        fHandledate: "",
        fHandledates: "", // 处理日期
        fHandleusername: "", // 处理人名称
        fHandlefile: "", // 处理附件id
        fFirstcheckresult: "", // 一级审核处理结果
        fFirstcheckopinion: "", // 一级审核处理意见
        fFirstcheckusername: "", // 一级审核处理人name
        fFirstcheckdates: "", // 一级审核处理日期
        fSecondcheckresult: "", // 二级审核处理结果
        fSecondcheckopinion: "", // 二级审核处理意见
        fSecondcheckusername: "", // 二级审核处理人name
        fSecondcheckdates: "", // 二级审核处理日期
        aduitStatus: null,
        userId: "", // 当前登录人id
        userName: "", // 当前登录人姓名
        recordfiles: [], // 删除文件id集合
      },
      typeData: [
        { text: "材料详情", show: true },
        { text: "级配曲线", show: false },
      ],
      level: [], //强度等级
      // 列表配置项
      type_config: null,
      tableData: [], //表格列表数据列表
      material_config: formJs.material_config,
      materialData: [], //材料用量列表

      fId: null, //点击当前列表数据fId
      checkStatus: null, //闭合状态

      userInfo: {}, //登录用户

      activeNames: ["0"],
      handNum: false, //闭合申请单
      firstNum: false, //一级审核
      secondNum: false, //二级审核
      btnShow: true, //保存按钮是否显示
      fSourcefileList: [],
      dialogTitle: "编辑",
      headerData: [],
      lineList: [],
      warningItems: null,
    };
  },
  watch: {
    commonData: {
      handler(newVal) {
        if (newVal) {
          console.log(525252, newVal.data);
          this.allData = newVal;
          this.getData(newVal);
        }
      },
      immediate: true,
    },
  },
  components: {
    publicForm, //弹框表格
    multiLevelTableData,
    errorMonitoring,
    TableData,
  },

  mounted() {
    var that = this;
    actions.onGlobalStateChange((state, prev) => {
      this.userInfo = prev.currentUser;
      //   getUserNature({
      //     username: this.userInfo.loginName,
      //   })
      //     .then((res) => {
      //       if (res.errcode) {
      //         this.userInfo.companyNature = res.data.Nature;
      // this.yj_viewForm(JSON.parse(this.$route.query.data),this.userInfo.companyNature)

      //     } else {
      //         console.log("获取当前用户机构性质", res.msg);
      //         // this.$message.error("获取当前用户机构性质", res.msg);
      //       }
      //     })
      // .catch((err) => {
      //   this.$message.error("获取当前用户机构性质接口报错", err.msg);
      //   console.log("当前用户机构性质err", err);
      // });
      //   this.token = prev.token;
      //   var data = prev.currentUser.projects;
      //   this.projectsObj = [
      //     {
      //       fItemName: "所有项目",
      //       fItemValue: "",
      //     },
      //   ];
      //   data.map((item) => {
      //     this.projectsObj.push({
      //       fItemName: item.projectName,
      //       fItemValue: item.projectId,
      //     });
      //   });
    }, true);
    setTimeout(() => {
      that.type_config = formJs.type_config;
    }, 800);
  },

  destroyed() {},
  methods: {
    goBack() {
      this.$router.back();
    },
    // 折叠面板
    changeCollapse(e) {
      console.log(this.activeNames, e);
    },
    changeType(e, index) {
      for (let i in this.typeData) {
        if (parseFloat(i) === index) {
          this.typeData[i].show = true;
          // checked = this.typeData[i].text;
        } else {
          this.typeData[i].show = false;
        }
      }
      // this.checked = checked;
    },
    getData(row) {
      console.log(52, row);
      this.handleData.userId = this.userInfo.id; // 当前登录人id
      this.handleData.userName = this.userInfo.userName; // 当前登录人姓名
      this.typeData[0].show = true;
      this.typeData[1].show = false;
      var id = row.data.fId;
      this.btnShow = true; //显示保存按钮，当查看时隐藏
      this.handleObj = formJs.handleObjs; //新增编辑配置参数
      this.processObj = formJs.processObjs; //一级审核
      this.examineObjs = formJs.examineObjs; //二级审核
      this.checkStatus = row.data.fCheckstatus; //闭合状态
      // this.closeOperation = row.fCloseoperation //闭合状态
      this.handleData.aduitStatus = row.data.fCheckstatus; //闭合状态
      var time = new Date();
      const y = time.getFullYear();
      const m = (time.getMonth() + 1 + "").padStart(2, "0");
      const d = (time.getDate() + "").padStart(2, "0");
      // this.dialogTitle = '编辑'

      this.$emit("dialogTitle", "编辑");
      // console.log(this.userInfo.companyNature, row.data.fCheckstatus, row.data.fCloseoperation);
      if (
        this.userInfo.companyNature == "施工单位" &&
        row.data.fCheckstatus == 0 &&
        row.data.fCloseoperation == "未闭合"
      ) {
        this.handNum = true; //申请单显示
        this.firstNum = false; //一级审核显示
        this.secondNum = false; //二级审核显示
        this.activeNames = ["0"]; //默认展开折叠面板
        this.handleObj = this.handleObjs1;
        this.handleData = {
          fId: "", // 申请单fid //为空判断为新增
          fCompanyid: row.companyId, // 施工标段id
          fParentid: "", // 对应的超标记录fid
          fWarningcontent: "", // 预警内容
          fReason: "", // 问题原因
          fHandleway: "", // 处理方式
          fHandleresult: "", // 处理结果
          fHandledate: "",
          fHandledates: "", // 处理日期
          fHandleusername: "", // 处理人名称
          fHandlefile: "", // 处理附件id
          fFirstcheckresult: "", // 一级审核处理结果
          fFirstcheckopinion: "", // 一级审核处理意见
          fFirstcheckusername: "", // 一级审核处理人name
          fFirstcheckdates: "", // 一级审核处理日期
          fSecondcheckresult: "", // 二级审核处理结果
          fSecondcheckopinion: "", // 二级审核处理意见
          fSecondcheckusername: "", // 二级审核处理人name
          fSecondcheckdates: "", // 二级审核处理日期
          aduitStatus: row.data.fCheckstatus,
          userId: this.userInfo.id, // 当前登录人id
          userName: this.userInfo.userName, // 当前登录人姓名
          recordfiles: [], // 删除文件id集合
        };

        this.fSourcefileList = [];
        this.handleData.fHandledates = `${y}-${m}-${d}`; // 处理日期
      } else if (
        this.userInfo.companyNature == "总监办" &&
        row.data.fCheckstatus == 1 &&
        row.data.fCloseoperation == "未闭合"
      ) {
        this.handNum = true; //申请单显示
        this.firstNum = true; //一级审核显示
        this.secondNum = false; //二级审核显示
        this.activeNames = ["1"]; //默认展开折叠面板
        this.handleObj.map((item) => {
          //闭合单
          item.disabled = true; //闭合单禁用
          item.uploadSelect = false; //上传附件按钮是否显示
          item.rules = []; //必填项不必填
        });
        this.processObj = this.processObj1;
        this.handleData = {
          fId: "", // 申请单fid //为空判断为新增
          fCompanyid: row.companyId, // 施工标段id
          fParentid: this.fId, // 对应的超标记录fid
          fWarningcontent: "", // 预警内容
          fReason: "", // 问题原因
          fHandleway: "", // 处理方式
          fHandleresult: "", // 处理结果
          fHandledate: "",
          fHandledates: "", // 处理日期
          fHandleusername: "", // 处理人名称
          fHandlefile: "", // 处理附件id
          fFirstcheckresult: "", // 一级审核处理结果
          fFirstcheckopinion: "", // 一级审核处理意见
          fFirstcheckusername: "", // 一级审核处理人name
          fFirstcheckdates: "", // 一级审核处理日期
          fSecondcheckresult: "", // 二级审核处理结果
          fSecondcheckopinion: "", // 二级审核处理意见
          fSecondcheckusername: "", // 二级审核处理人name
          fSecondcheckdates: "", // 二级审核处理日期
          aduitStatus: row.data.fCheckstatus,
          userId: this.userInfo.id, // 当前登录人id
          userName: this.userInfo.userName, // 当前登录人姓名
          recordfiles: [], // 删除文件id集合
        };

        this.handleData.fFirstcheckdates = `${y}-${m}-${d}`; //一级审核处理日期
      } else if (
        this.userInfo.companyNature == "建设单位" &&
        row.data.fCheckstatus == 2 &&
        row.data.fCloseoperation == "未闭合"
      ) {
        this.handNum = true;
        this.firstNum = true;
        this.secondNum = true;
        this.activeNames = ["2"]; //默认展开折叠面板
        this.handleObj.map((item) => {
          //闭合单
          item.disabled = true; //闭合单禁用
          item.uploadSelect = false; //上传附件按钮是否显示
          item.rules = []; //必填项不必填
        });
        this.processObj.map((item) => {
          //一级审核
          item.disabled = true; //一级审核表单禁用
          item.rules = []; //必填项不必填
        });
        this.examineObjs = this.examineObjs1;
        this.handleData = {
          fId: "", // 申请单fid //为空判断为新增
          fCompanyid: row.companyId, // 施工标段id
          fParentid: this.fId, // 对应的超标记录fid
          fWarningcontent: "", // 预警内容
          fReason: "", // 问题原因
          fHandleway: "", // 处理方式
          fHandleresult: "", // 处理结果
          fHandledate: "",
          fHandledates: "", // 处理日期
          fHandleusername: "", // 处理人名称
          fHandlefile: "", // 处理附件id
          fFirstcheckresult: "", // 一级审核处理结果
          fFirstcheckopinion: "", // 一级审核处理意见
          fFirstcheckusername: "", // 一级审核处理人name
          fFirstcheckdates: "", // 一级审核处理日期
          fSecondcheckresult: "", // 二级审核处理结果
          fSecondcheckopinion: "", // 二级审核处理意见
          fSecondcheckusername: "", // 二级审核处理人name
          fSecondcheckdates: "", // 二级审核处理日期
          aduitStatus: row.data.fCheckstatus,
          userId: this.userInfo.id, // 当前登录人id
          userName: this.userInfo.userName, // 当前登录人姓名
          recordfiles: [], // 删除文件id集合
        };

        this.handleData.fSecondcheckdates = `${y}-${m}-${d}`; //二级审核处理日期
      } else {
        //查看页面
        // this.dialogTitle = '查看'

        this.$emit("dialogTitle", "查看");
        this.btnShow = false;
        if (row.data.fCheckstatus == 0) {
          this.handNum = false; //闭合申请单显示
          this.firstNum = false; //一级审核显示
          this.secondNum = false; //二级审核显示
        } else if (row.data.fCheckstatus == 1) {
          this.handNum = true; //闭合申请单显示
          this.firstNum = false; //一级审核显示
          this.secondNum = false; //二级审核显示
          this.activeNames = ["0"]; //默认展开折叠面板
          this.handleObj.map((item) => {
            //闭合单
            item.disabled = true; //闭合单禁用
            item.uploadSelect = false; //上传附件按钮是否显示
            item.rules = []; //必填项不必填
          });
        } else if (row.data.fCheckstatus == 2) {
          this.handNum = true; //闭合申请单显示
          this.firstNum = true; //一级审核显示
          this.secondNum = false; //二级审核显示
          this.activeNames = ["0", "1"]; //默认展开折叠面板
          this.handleObj.map((item) => {
            //闭合单
            item.disabled = true; //闭合单禁用
            item.uploadSelect = false; //上传附件按钮是否显示
            item.rules = []; //必填项不必填
          });
          this.processObj.map((item) => {
            //一级审核
            item.disabled = true; //一级审核表单禁用
            item.rules = []; //必填项不必填
          });

          this.examineObjs.map((item) => {
            //二级审核
            item.disabled = true; //二级审核表单禁用
            item.rules = []; //必填项不必填
          });
        } else if (row.data.fCheckstatus == 3) {
          this.handNum = true; //闭合申请单显示
          this.firstNum = true; //一级审核显示
          this.secondNum = true; //二级审核显示
          this.activeNames = ["0", "1", "2"]; //默认展开折叠面板
          this.handleObj.map((item) => {
            //闭合单
            item.disabled = true; //闭合单禁用
            item.uploadSelect = false; //上传附件按钮是否显示
            item.rules = []; //必填项不必填
          });
          this.processObj.map((item) => {
            //一级审核
            item.disabled = true; //一级审核表单禁用
            item.rules = []; //必填项不必填
          });
          this.examineObjs.map((item) => {
            //二级审核
            item.disabled = true; //二级审核表单禁用
            item.rules = []; //必填项不必填
          });
        }
      }

      this.fId = row.data.fId; //闭合数据id

      this.fPhotofilelist = [];
      this.getLqHeaderData(row.data.fMachineid);
      if (id != "" && id != null) {
        getAsphaltClosedFormByParentId({
          fId: id,
          fCompanyid: row.companyId,
        }).then((res) => {
          if (res.errcode == 0) {
            this.$emit("loadingShow", false);

            this.formData = res.data.dischargeinfo;
            var materialList = res.data.dischargeinfo.materialList; //// 物料信息
            materialList[0]["name"] = "设计比例(%)";
            materialList[1]["name"] = "实际比例(%)";
            materialList[2]["name"] = "实际用量(kg)";
            materialList[3]["name"] = "误差(%)";
            (materialList[4] = {
              name: "",
              show: true,
              param0: res.data.dischargeinfo.materialList[3].warntext0,
              param1: res.data.dischargeinfo.materialList[3].warntext1,
              param2: res.data.dischargeinfo.materialList[3].warntext2,
              param3: res.data.dischargeinfo.materialList[3].warntext3,
              param4: res.data.dischargeinfo.materialList[3].warntext4,
              param5: res.data.dischargeinfo.materialList[3].warntext5,
              param6: res.data.dischargeinfo.materialList[3].warntext6,
              param7: res.data.dischargeinfo.materialList[3].warntext7,
            }),
              (this.materialData = materialList);
            this.level = [
              //预警级别
              "",
              this.materialData[3].warnvalue0,
              this.materialData[3].warnvalue1,
              this.materialData[3].warnvalue2,
              this.materialData[3].warnvalue3,
              this.materialData[3].warnvalue4,
              this.materialData[3].warnvalue5,
              this.materialData[3].warnvalue6,
              this.materialData[3].warnvalue7,
            ];
            if (res.data.dischargeinfo.asphaltRecipe != null) {
              var lqtableData = res.data.dischargeinfo.asphaltRecipe.linkedList;
              lqtableData[0]["dischargeDates"] = "级配上限";
              lqtableData[1]["dischargeDates"] = "级配下限";
              lqtableData[2]["dischargeDates"] = "级配中值";
              lqtableData[3]["dischargeDates"] = "目标级配";
              lqtableData[4]["dischargeDates"] = "实际级配";

              this.lqtableData = lqtableData;
              var lineList = res.data.dischargeinfo.asphaltRecipe.lineList; // 折线信息
              this.lineList = lineList;
              // 闭合
              var totalData = res.data.closeinfo; //闭合申请单、一级、二级审核
              this.warningItems = res.data.closeinfo.warningItems;
              this.handleData.fParentid = this.fId; //对应的超标记录fid

              if (this.checkStatus == 0) {
                this.handleData.fId = totalData.fId; //申请单fid //为空判断为新增
                this.handleData.fWarningcontent = totalData.fWarningcontent; // 预警内容
                this.handleData.fHandlefile = totalData.fHandlefile; //处理附件id
                this.handleData.fCompanyid = totalData.fCompanyid; // 施工标段id
              } else if (this.checkStatus == 1) {
                this.handleData.fId = totalData.fId; //申请单fid //为空判断为新增
                this.handleData.fCompanyid = totalData.fCompanyid; // 施工标段id
                this.handleData.fWarningcontent = totalData.fWarningcontent; // 预警内容
                this.handleData.fReason = totalData.fReason; // 问题原因
                this.handleData.fHandleresult = totalData.fHandleresult; // 处理结果
                this.handleData.fHandledates = totalData.fHandledates; //处理日期
                this.handleData.fHandleusername = totalData.fHandleusername; // 处理人名称
                this.fSourcefileList = res.data.fSourcefileList; // 附件
                this.handleData.fHandlefile = totalData.fHandlefile; //处理附件id
                this.handleData.fHandleway = totalData.fHandleway; // 处理方式
              } else if (this.checkStatus == 2) {
                this.handleData.fId = totalData.fId; //申请单fid //为空判断为新增
                this.handleData.fCompanyid = totalData.fCompanyid; // 施工标段id
                this.handleData.fWarningcontent = totalData.fWarningcontent; // 预警内容
                this.handleData.fReason = totalData.fReason; // 问题原因
                this.handleData.fHandleresult = totalData.fHandleresult; // 处理结果
                this.handleData.fHandledates = totalData.fHandledates; //处理日期
                this.handleData.fHandleusername = totalData.fHandleusername; // 处理人名称
                this.fSourcefileList = res.data.fSourcefileList; // 附件
                this.handleData.fHandlefile = totalData.fHandlefile; //处理附件id
                this.handleData.fHandleway = totalData.fHandleway; // 处理方式
                this.handleData.fFirstcheckresult = totalData.fFirstcheckresult; // 一级审核处理结果
                this.handleData.fFirstcheckopinion =
                  totalData.fFirstcheckopinion; // 一级审核处理意见
                this.handleData.fFirstcheckusername =
                  totalData.fFirstcheckusername; //一级审核处理人name
                this.handleData.fFirstcheckdates = totalData.fFirstcheckdates; //一级审核处理日期
              } else if (this.checkStatus == 3) {
                this.handleData.fId = totalData.fId; //申请单fid //为空判断为新增
                this.handleData.fCompanyid = totalData.fCompanyid; // 施工标段id
                this.handleData.fWarningcontent = totalData.fWarningcontent; // 预警内容
                this.handleData.fReason = totalData.fReason; // 问题原因

                this.handleData.fHandleresult = totalData.fHandleresult; // 处理结果
                this.handleData.fHandledates = totalData.fHandledates; //处理日期
                this.handleData.fHandleusername = totalData.fHandleusername; // 处理人名称
                this.fSourcefileList = res.data.fSourcefileList; // 附件
                this.handleData.fHandlefile = totalData.fHandlefile; //处理附件id
                this.handleData.fHandleway = totalData.fHandleway; // 处理方式
                this.handleData.fFirstcheckresult = totalData.fFirstcheckresult; // 一级审核处理结果
                this.handleData.fFirstcheckopinion =
                  totalData.fFirstcheckopinion; // 一级审核处理意见
                this.handleData.fFirstcheckusername =
                  totalData.fFirstcheckusername; //一级审核处理人name
                this.handleData.fFirstcheckdates = totalData.fFirstcheckdates; //一级审核处理日期
                this.handleData.fSecondcheckresult =
                  totalData.fSecondcheckresult; // 二级审核处理结果
                this.handleData.fSecondcheckopinion =
                  totalData.fSecondcheckopinion; // 二级审核处理意见
                this.handleData.fSecondcheckusername =
                  totalData.fSecondcheckusername; //二级审核处理人name
                this.handleData.fSecondcheckdates = totalData.fSecondcheckdates; //二级审核处理日期
              }
              // 闭合
            } else {
              this.lqtableData = [];
              this.lineList = [];
            }
          } else {
            this.$message.error(res.msg);
          }
        });
      }
      // else {
      //     return this.$message.error("请先选择需要查看的数据");
      // }
    },
    getLqHeaderData(id) {
      // var aa = [];
      let params = {
        machineId: id,
      };
      this.$store.dispatch("getLqCommonData/getLqCommonData", params);
      //  中使用了命名空间，所以 需要在dispatch的时候在 getDataInfo前面加上moduleName
      var that = this;
      setTimeout(() => {
        that.headerData = JSON.parse(
          JSON.stringify(this.$store.state.getLqCommonData.dataList)
        );

        that.material_config.thead[2].label = that.headerData.fParm1;
        that.material_config.thead[3].label = that.headerData.fParm2;
        that.material_config.thead[4].label = that.headerData.fParm3;
        that.material_config.thead[5].label = that.headerData.fParm4;
        that.material_config.thead[6].label = that.headerData.fParm5;
        that.material_config.thead[7].label = that.headerData.fParm6;
      }, 500);
    },
    yj_saveForm() {
      this.handleData.fCompanyid = this.allData.companyId; // 施工标段id
      if (this.checkStatus == 0) {
        //闭合申请单
        if (this.$refs.publicForm0.submitForm()) {
          this.saveForm(this.handleData);
          console.log("闭合申请单", this.handleData);
        } else {
          console.log("error");
        }
      } else if (this.checkStatus == 1) {
        if (this.$refs.publicForm1.submitForm()) {
          console.log("一级审核", this.handleData);
          this.saveForm(this.handleData);
        } else {
          console.log("error");
        }
      } else if (this.checkStatus == 2) {
        if (this.$refs.publicForm2.submitForm()) {
          console.log("二级审核", this.handleData);
          this.saveForm(this.handleData);
        } else {
          console.log("error");
        }
      }
    },
    // 保存接口
    saveForm(data) {
      addAsphaltClosedForm(data)
        .then((res) => {
          if (res.errcode == 0) {
            this.$emit("searchForm");
            this.$emit("dialogShow", false);
            this.$message.success("新增成功");
          } else {
            this.$message.error(res.msg);
            console.log("接口报错");
          }
        })
        .catch((error) => {
          console.log("拌合站设置-新增）", error);
        });
    },
    close() {
      this.$emit("dialogShow", false);
    },
    delteFile(file) {
      // console.log(file, this.fSourcefileList);
      for (let index = 0; index < this.fSourcefileList.length; index++) {
        if (file.uid == this.fSourcefileList[index].uid) {
          if (this.fSourcefileList[index].atta == undefined) {
            this.handleData.recordfiles.push({
              fId: this.fSourcefileList[index].fId,
            });
          } else {
            this.handleData.recordfiles.push({
              fId: this.fSourcefileList[index].atta.fId,
            });
          }
          this.fSourcefileList.splice(index, 1);
        }
      }
    },
  },
};
</script>
<style lang="less" scope>
.jpbox {
  height: 100%;
}

.dialogBody {
  padding: 3px 20px;
  height: 80%;
  // overflow-y: auto;
  display: flex;
  flex-direction: column;

  .jpbox {
    height: 100%;
  }

  .dialogBody {
    position: relative;
  }

  .tab {
    display: flex;
    font-size: 14px;
    height: 30px;
    line-height: 30px;
    box-sizing: border-box;
    border-bottom: 2px solid #e4e7ed;
    padding: 0 0.16rem;
    margin-bottom: 30px;

    .btn {
      margin-top: 4px;
      margin-right: 16px;
      width: 102px;
      height: 24px;
      display: flex;
      justify-content: center;
      align-items: center;
      border-top-right-radius: 4px;
      border-top-left-radius: 4px;
    }
  }

  .charts {
    // height: calc(100% - 30px);
    height: 620px;
  }
}

.baseTitle {
  /* border: 1px solid #0c204d; */
  border-bottom: 1px solid #0c204d;

  height: 30px;
  line-height: 30px;
  position: relative;
  padding-left: 15px;
}

.baseTitle::after {
  display: block;
  content: "";
  height: 30px;
  width: 5px;
  position: absolute;
  left: 0;
  top: 0;
  background: #0c204d;
}

.materialClass /deep/.el-table tr:nth-child(4) {
  display: none;
}

.jipeiBoxs {
  display: flex;
  flex: 1;

  .left {
    width: 60%;
    margin-right: 15px;
    display: flex;
    flex-direction: column;

    .errorMonitoring {
      flex: 1;
    }
  }

  .right {
    width: 40%;

    display: flex;
    flex-direction: column;

    .errorMonitoring {
      flex: 1;
      box-sizing: border-box;
      display: flex;
      justify-content: center;
      align-items: center;

      .tableWaring {
        width: 90%;
        height: 85%;
        margin: 15px;
        box-sizing: border-box;

        display: flex;
        flex-direction: column;
        align-content: space-around;
        border: 1px solid #ebeef5;
        border-bottom: none;

        .line {
          flex: 1;
          display: flex;
          line-height: 20px;
          // height: 25px;
          // line-height: 25px;
          border-bottom: 1px solid #ebeef5;

          .tableName {
            width: 40%;
            display: flex;
            justify-content: center;
            align-items: center;
            border-right: 1px solid #ebeef5;
          }

          .tableData {
            width: 55%;
            padding-left: 8px;
            display: flex;
            align-items: center;
          }
        }

        .line:nth-child(2n) {
          background: #dbe7f5;
          color: #4f6375;
        }
      }
    }
  }
}
</style>
